#!/bin/bash
#This script insures that CARBLogger has started
#it should be run once after each reboot five minutes following
#initial startup.
#wait for 5 minutes
sleep 600
wait
is_up=`ps -ef | grep "CARBLogger" | grep gnome-terminal | wc -l`
if [ ${is_up} < 1 ]; then
	{
	
		export DISPLAY=:0 && /usr/bin/gnome-terminal --working-directory=/home/aqdms/CARBLog --title=\-\-\=\=CARBLogger\=\=\-\- -e './interface.sh' 1> /dev/null 2>/dev/null &
		message=`echo ""date": CARBLogger was not started following reboot. We started it for you. PID: $!" `
		echo $message >> Data/CARBLogger.log
		exit 0
				
	}
else
	{
		message=`echo ""date": CARBLogger was started following reboot. Nothing left to do." `
		echo $message >> Data/CARBLogger.log
		exit 1	
	}
fi
exit
